/*
 * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Autogenerated file -- DO NOT EDIT!

void RegEncoder::VisitIf([[maybe_unused]] GraphVisitor* v, Inst* instBase) {
    [[maybe_unused]] auto re = static_cast<RegEncoder*>(v);
    [[maybe_unused]] auto inst = instBase->CastToIf();
    switch (inst->GetCc()) {
    case compiler::CC_EQ:
    case compiler::CC_NE:
    case compiler::CC_LT:
    case compiler::CC_LE:
    case compiler::CC_GT:
    case compiler::CC_GE: {
        re->Check8Width(inst);
        break;
    }
    default:
        LOG(DEBUG, BYTECODE_OPTIMIZER) << "CheckWidth for " << compiler::GetOpcodeString(inst->GetOpcode()) << " failed";
        re->success_ = false;
    }
}
void RegEncoder::VisitIfImm([[maybe_unused]] GraphVisitor* v, Inst* instBase) {
    [[maybe_unused]] auto re = static_cast<RegEncoder*>(v);
    [[maybe_unused]] auto inst = instBase->CastToIfImm();
    switch (inst->GetCc()) {
    case compiler::CC_EQ:
    case compiler::CC_NE:
    case compiler::CC_LT:
    case compiler::CC_LE:
    case compiler::CC_GT:
    case compiler::CC_GE: {
        break;
    }
    default:
        LOG(DEBUG, BYTECODE_OPTIMIZER) << "CheckWidth for " << compiler::GetOpcodeString(inst->GetOpcode()) << " failed";
        re->success_ = false;
    }
}
void RegEncoder::VisitCast([[maybe_unused]] GraphVisitor* v, Inst* instBase) {
    [[maybe_unused]] auto re = static_cast<RegEncoder*>(v);
    [[maybe_unused]] auto inst = instBase->CastToCast();
}
% call_me_from_template

// NOLINTBEGIN(readability-redundant-control-flow)

% visitors.each do |visitor|
void RegEncoder::Visit<%= visitor.ir_op %>([[maybe_unused]] GraphVisitor* v, Inst* instBase) {
    [[maybe_unused]] auto re = static_cast<RegEncoder*>(v);
    [[maybe_unused]] auto inst = instBase->CastTo<%= visitor.ir_op %>();
<%= visitor.cpp %>
<%= visitor.switch.check_width %>
}
% end

// NOLINTEND(readability-redundant-control-flow)
